/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Dell
 */
@Entity
@Table(name = "marquage")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Marquage.findAll", query = "SELECT m FROM Marquage m"),
    @NamedQuery(name = "Marquage.findByRefmarquage", query = "SELECT m FROM Marquage m WHERE m.refmarquage = :refmarquage"),
    @NamedQuery(name = "Marquage.findByVecteurMarquage", query = "SELECT m FROM Marquage m WHERE m.vecteurMarquage = :vecteurMarquage"),
    @NamedQuery(name = "Marquage.findByIdm", query = "SELECT m FROM Marquage m WHERE m.idm = :idm")})
public class Marquage implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "refmarquage")
    private Integer refmarquage;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "VecteurMarquage")
    private String vecteurMarquage;
    @JoinColumn(name = "idm", referencedColumnName = "idm")
    @ManyToOne(optional = false)
    private Modelerdp idm;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "refmarquage")
    private Collection<Trace> traceCollection;
//Constructeur
    public Marquage() {
    }

    public Marquage(Integer refmarquage) {
        this.refmarquage = refmarquage;
    }

    public Marquage(Integer refmarquage, String vecteurMarquage) {
        this.refmarquage = refmarquage;
        this.vecteurMarquage = vecteurMarquage;
    }

    public Integer getRefmarquage() {
        return refmarquage;
    }

    public void setRefmarquage(Integer refmarquage) {
        this.refmarquage = refmarquage;
    }

    public String getVecteurMarquage() {
        return vecteurMarquage;
    }

    public void setVecteurMarquage(String vecteurMarquage) {
        this.vecteurMarquage = vecteurMarquage;
    }

    public Modelerdp getIdm() {
        return idm;
    }

    public void setIdm(Modelerdp idm) {
        this.idm = idm;
    }

    @XmlTransient
    public Collection<Trace> getTraceCollection() {
        return traceCollection;
    }

    public void setTraceCollection(Collection<Trace> traceCollection) {
        this.traceCollection = traceCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (refmarquage != null ? refmarquage.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Marquage)) {
            return false;
        }
        Marquage other = (Marquage) object;
        if ((this.refmarquage == null && other.refmarquage != null) || (this.refmarquage != null && !this.refmarquage.equals(other.refmarquage))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "" + refmarquage;
    }
    
}
